package service.impl;

import mapper.AppInfoMapper;
import org.springframework.stereotype.Service;
import pojo.AppCategory;
import pojo.AppInfo;
import pojo.DataDictionary;
import service.AppInfoService;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service("appInfoService")
public class AppInfoServiceImpl implements AppInfoService {
    @Resource
private AppInfoMapper appInfoMapper;

    public List<AppInfo> appInfoList(AppInfo appInfo, int pageNo, int pageSize){
            Map<String,Object> AppInfoPage=new HashMap<String,Object>();
            AppInfoPage.put("appInfo",appInfo);
            AppInfoPage.put("pageNo",pageNo);
            AppInfoPage.put("pageSize",pageSize);

        return  appInfoMapper.appInfoList(AppInfoPage);

        }

    public  int appListCount(AppInfo appInfo){


        return appInfoMapper.appListCount(appInfo).size();
    }
    //查询字典表信息
    public List<DataDictionary> DataDictionaryList(String typeCode){

        return appInfoMapper.DataDictionaryList(typeCode);
    }
    public List<AppCategory> appCategoryList(Integer fid){

        return appInfoMapper.appCategoryList(fid);
    }//三级分类查询
    public List<AppCategory> appCategoryLists(Integer fid){

        return appInfoMapper.appCategoryLists(fid);
    }
    //根据ID删除基础信息表信息
    public int deleteAppInfo(int inId){
        //删除APP信息同时删除App版本信息
        int deleteAppVersion= appInfoMapper.deleteAppVersion(inId);
        int deleteAppInfo=0;

           deleteAppInfo=appInfoMapper.deleteAppInfo(inId);

        return deleteAppInfo;
    }
    //删除APP同时删除所有本APP版本信息

    //商品下架
    public int AppInfoLowerShelf(int inId){

        return appInfoMapper.AppInfoLowerShelf(inId);
    }
    //添加APP基础信息
    public int AddAppInfo(AppInfo appInfo){

        return appInfoMapper.AddAppInfo(appInfo);
    }
    //根据ID查询App信息
    public AppInfo appInfoListId(int noid){


        return appInfoMapper.appInfoListId(noid);
    }
    //修改APP基础信息
    public int UpdateAppInfo(AppInfo appInfo){
        return  appInfoMapper.UpdateAppInfo(appInfo);
    }
    //根据ID修改App状态
    public int UpdateAppInfostatus(int AppId,int status){

        return appInfoMapper.UpdateAppInfostatus(AppId,status);
    }
}
